export interface ResponseData {
  code: number
  message: string
  ok: boolean
}

export interface SpuData {
  category3Id: number | string
  id?: number | string
  spuName: string
  tmId: number | string
  description: string
  // 查询是并没有这两个属性，修改是需要额外添加接口去查询这两个字段
  spuImageList: null | SpuImg[]
  spuSaleAttrList: null | SaleAttr[]
}

export type Records = SpuData[]

export interface HasResponseData extends ResponseData {
  data: {
    records: Records
    total: number
    size: number
    current: number
    searchCount: boolean
    pages: number
  }
}

export interface TradeMark {
  id: number
  tmName: string
  logoUrl: string
}

export interface AllTradeMark extends ResponseData {
  data: TradeMark[]
}

// 照片墙数据
export interface SpuImg {
  id?: number
  imgName?: string
  imgUrl?: string
  spuid?: number
  createTime?: string
  updateTime?: string
  name?: string
  url?: string
  response?: any
}

export interface SpuHasImg extends ResponseData {
  data: SpuImg[]
}

// 已有的销售属性
export interface SaleAttrValue {
  id?: number
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: null
}

export type SpuSaleAttrValueList = SaleAttrValue[]
export interface SaleAttr {
  id?: number
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrName: string
  spuSaleAttrValueList: SpuSaleAttrValueList
  flag?: boolean
  saleAttrValue?: string
  saleIdAndValueId?: string
}

export interface SaleAttrResponseData extends ResponseData {
  data: SaleAttr[]
}

// 已有的全部SPU的返回数据ts类型
export interface HasSaleAttr {
  id: number
  name: string
}

export interface HasSaleAttrResponse extends ResponseData {
  data: HasSaleAttr[]
}

export interface Attr {
  attrId: number | number
  valueId: number | number
}

export interface SaleArr {
  saleAttrId: number | number
  saleAttrValueId: number | number
}

// sku类型
export interface SkuData {
  category3Id: number | string
  spuId: number | string
  tmId: number | string
  skuName: string
  price: string | number
  weight: string | number
  skuDesc: string
  skuAttrValueList?: Attr[]
  skuSaleAttrValueList?: SaleArr[]
  skuDefaultImg: string
}

// skuInfo
export interface SkuInfoData extends ResponseData {
  data: SkuData[]
}
